package org.sourcecode.common.cas.client;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;

public class CasSessionUtils {

	public static final String getCookie(HttpServletRequest request, String cookiename) {
		Cookie[] cookies = request.getCookies();
		if (cookies == null) {
			return null;
		}
		for (int i = 0; i < cookies.length; i++) {
			Cookie c = cookies[i];
			if (cookiename.equals(c.getName())) {
				return c.getValue();
			}
		}
		return null;
	}
}
